<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>

    /**
     * callback
     * 把函数当成参数来传递
     * @param num
     * @returns {number}
     */
    function isOdd(num) {
        return num % 2
    }

    const arr = [3, 4, 5, 7, 8, 9]
    const result = arr.filter(isOdd)
    console.log(result)


    function download(url,callback){
       setTimeout(()=>{
           console.log(`正在下载图片 ` + url )
           callback(url)
       },2000)
    }

    function upload(url){
        console.log(`正在上传图片 ` + url )
    }

    const url = "https://www.baidu.com/pics/1.png"

    download(url,upload)
</script>
</body>
</html>
